﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Wicresoft.RDW.Utility
{
  public static  class MailFormat
    {
      /// <summary>
      /// format Mail Body and Content
      /// </summary>
      /// <param name="body"></param>
      /// <param name="replaceContent"></param>
      /// <returns></returns>
      public static string TemplateFormat(string body, string replaceContent)
      {
          object[] _pharm = replaceContent.Split('^');
          try
          {
              string formatBody = string.Format(body, _pharm);
              return formatBody;
          }
          catch
          {
              throw new Exception("Mail Template error !");
          }
          finally { };
      }
      /// <summary>
      /// format Mail Body and Content
      /// </summary>
      /// <param name="body"></param>
      /// <param name="replaceContent"></param>
      /// <returns></returns>
      [Microsoft.SqlServer.Server.SqlProcedure]
      public static void TemplateFormat(string body, string replaceContent,out string  result)
      {
          object[] _pharm = replaceContent.Split('^');
          try
          {
              string formatBody = string.Format(body, _pharm);
              result= formatBody;
          }
          catch
          {
              throw new Exception("Mail Template error !");
          }
          finally { };
      }
    }
}
